import React from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import { store, persistor } from 'store/store';
import { PersistGate } from 'redux-persist/integration/react';
import { Provider } from 'react-redux';
import { GlobalStyle } from 'assets/css/style/style';
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'

import Home from 'pages/home/Home';
import Login from 'pages/login/Login';
import Register from 'pages/register/Register';
import ModifyPassword from 'pages/modify-password/ModifyPassword';
import MyRouter from 'router/router';

// 默认语言为 en-US，如果你需要设置其他语言，推荐在入口文件全局设置 locale
import moment from 'moment';
import 'moment/locale/zh-cn';
moment.locale('zh-cn');

function Error404() {
  return <h1>error-404</h1>;
}

function App() {
  return (
    <Provider store={store}>
      <PersistGate loading={null} persistor={persistor}>
        <GlobalStyle />
        <Router basename='/website-su-admin'>
          <div className='App'>
            <Switch>
              <Route path={MyRouter.Login.path} component={Login} />
              {/* <Route path='/register' component={Register} /> */}
              {/* <Route path='/modify-password' component={ModifyPassword} /> */}
              <Route path='/' component={Home} />
              <Route component={Error404} />
            </Switch>
          </div>
        </Router>
      </PersistGate>
    </Provider>
  );
}

export default App;
